/*
 * exception.h
 *
 *  Created on: 2010-10-17
 *      Author: tan
 */

#ifndef EXCEPTION_H_
#define EXCEPTION_H_

#include <exception>
#include <string>
#include <strstream>
using namespace std;

char* __concat_exception(const char* file, const int& line, const char* msg);
#define trace(msg) (__concat_exception(__FILE__, __LINE__, msg))
#include <string.h>
#include <errno.h>
#define trace_errno() trace(strerror(errno))

namespace light {

class LightException : public std::exception {

public:
	const char* what() throw();

protected:
	std::string message;

public:
	LightException();
	LightException(const char* message);
	LightException(std::string message);
	virtual ~LightException() throw();
};

}

#endif /* EXCEPTION_H_ */
